package cn.sdhuijin.healthexam.activity;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sdhuijin.healthexam.ExitApplication;
import cn.sdhuijin.healthexam.R;
import cn.sdhuijin.healthexam.control.AbstractControlActivity;

public class ChanQianInfoActivity extends AbstractControlActivity implements
		OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_chanqian_info);
		ExitApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		// 获取传递过来的sql语句
		String fileName = intent.getStringExtra("filename");

		addTextView(R.id.txt_chanqian_name, "姓名");
		addTextView(R.id.txt_card_id, "身份证号");
		addTextView(R.id.txt_chanqian_age, "年龄");
		addTextView(R.id.txt_yunzhou, "填表孕周");
		addTextView(R.id.txt_chanqian_yindaofenwan, "阴道分娩次");
		addTextView(R.id.txt_chanqian_paogongchan, "剖宫产次");
		addTextView(R.id.txt_chanqian_mociyuejing, "末次月经");
		addTextView(R.id.txt_chanqian_yuchanqi, "预产期");
		addTextView(R.id.txt_chanqian_shengao, "身高");
		addTextView(R.id.txt_chanqian_tizhong, "体重");
		addTextView(R.id.txt_chanqian_tizhizhishu, "体质指数");
		addTextView(R.id.txt_chanqian_gaoya, "高压");
		addTextView(R.id.txt_chanqian_diya, "低压");
		addTextView(R.id.txt_chanqian_zhangfu_name, "丈夫姓名");
		addTextView(R.id.txt_chanqian_zhangfu_age, "丈夫年龄");
		addTextView(R.id.txt_chanqian_zhangfu_tel, "丈夫电话");
		addTextView(R.id.txt_xinzang, "心脏_content");
		addTextView(R.id.txt_xinzang_yc, "心脏异常");
		addTextView(R.id.txt_feibu, "肺部_content");
		addTextView(R.id.txt_feibu_yc, "肺部异常");
		addTextView(R.id.txt_jiwangshi, "既往史_content");
		addTextView(R.id.txt_jiwangshiqt, "其它既往史");
		addTextView(R.id.txt_jiazushi, "家族史_content");
		addTextView(R.id.txt_jiazushiqt, "其它家族史");
		addTextView(R.id.txt_gerenshi, "个人史_content");
		addTextView(R.id.txt_gerenshiqt, "其它个人史");
		addTextView(R.id.txt_yunchanshi, "孕产史_content");
		addTextView(R.id.txt_shoushushiqt, "妇科手术史_content");
		addTextView(R.id.txt_waiyin, "外阴_content");
		addTextView(R.id.txt_waiyin_ycsm, "外阴异常");
		addTextView(R.id.txt_yindao, "阴道_content");
		addTextView(R.id.txt_yindao_ycsm, "阴道异常");
		addTextView(R.id.txt_gongjing, "宫颈_content");
		addTextView(R.id.txt_gongjing_ycsm, "宫颈异常");
		addTextView(R.id.txt_zigong, "子宫_content");
		addTextView(R.id.txt_zigong_ycsm, "子宫异常");
		addTextView(R.id.txt_fujian, "附件_content");
		addTextView(R.id.txt_fujian_ycsm, "附件异常");

		addTextView(R.id.txt_xuehongdanbaizhi, "血红蛋白值");
		addTextView(R.id.txt_baixibaojishuzhi, "白细胞计数值");
		addTextView(R.id.txt_xuexiaobanjishuzhi, "血小板计数值");
		addTextView(R.id.txt_xuechanggui_qt, "血常规其他");
		addTextView(R.id.txt_niaodanbai, "尿蛋白");
		addTextView(R.id.txt_niaotang, "尿糖");
		addTextView(R.id.txt_niaotongti, "尿酮体");
		addTextView(R.id.txt_niaoqianxue, "尿潜血");
		addTextView(R.id.txt_niaochanggui_qt, "尿常规其他");
		addTextView(R.id.txt_xuexing, "血型");
		addTextView(R.id.txt_xuetang, "血糖");
		addTextView(R.id.txt_xueqinggubingzam, "血清谷丙转氨酶");
		addTextView(R.id.txt_xueqinggucaozam, "血清谷草转氨酶");
		addTextView(R.id.txt_baidanbai, "白蛋白");
		addTextView(R.id.txt_zongdanhongsu, "总胆红素");
		addTextView(R.id.txt_jihedanhongsu, "结合胆红素");
		addTextView(R.id.txt_xueqingjigan, "血清肌酐");
		addTextView(R.id.txt_xueniaosudan, "血尿素氮");
		addTextView(R.id.txt_yindaofenmiwu, "阴道分泌物_content");
		addTextView(R.id.txt_yindaofenm_qt, "其他阴道分泌物");
		addTextView(R.id.txt_yindaojiejingdu, "阴道清洁度_content");
		addTextView(R.id.txt_yxgybmky, "乙型肝炎表面抗原");
		addTextView(R.id.txt_yxgybmkt, "乙型肝炎表面抗体");
		addTextView(R.id.txt_yxgyeky, "乙型肝炎e抗原");
		addTextView(R.id.txt_yxgyekt, "乙型肝炎e抗体");
		addTextView(R.id.txt_yxgyhxkt, "乙型肝炎核心抗体");
		addTextView(R.id.txt_mdxqxsy, "梅毒血清学试验_content");
		addTextView(R.id.txt_hivktjc, "HIV抗体检测_content");
		addTextView(R.id.txt_jkzd, "保健指导_content");
		addTextView(R.id.txt_jkzd_qt, "其它保健指导");
		addTextView(R.id.txt_ztpg, "总体评估_content");

		addTextView(R.id.txt_zhuanzhen, "转诊_content");
		addTextView(R.id.txt_zhuanzhen_yy, "转诊原因");
		addTextView(R.id.txt_zhuanzhen_jgjks, "机构及科室");
		addTextView(R.id.txt_next_date, "下次随访日期");
		addTextView(R.id.txt_visit_doctor, "随访医生签名");
		addTextView(R.id.txt_suggestion, "指导意见");

		setButtonListener(this, R.id.btn_back);

		Properties prop = new Properties();
		try {
			File f = new File(Environment.getExternalStorageDirectory()
					.getPath() + "/health/" + fileName + ".txt");
			if (f.exists()) {

				controlManager.setPropertiesPath(f.getAbsolutePath());
				controlManager.toControl();

				prop.load(new FileReader(f.getAbsolutePath()));
			} else {
				this.toastInformation(R.string.record_deleted);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void onClick(View v) {
		int clickId = (Integer) v.getId();
		switch (clickId) {
		case R.id.btn_back:
			finish();
			break;
		default:
			break;
		}
	}

}
